package com.example;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader;
import org.apache.camel.support.ResourceHelper;

public class MyRouteBuilder extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        // 继续支持 Java DSL
        from("timer:java?period=3000")
                .setBody().constant("Hello from Java DSL")
                .log("${body}");
        getContext().addRoutes(
                new YamlRoutesBuilderLoader().loadRoutesBuilder(
                        ResourceHelper.resolveResource(getContext(), "classpath:routes/my-route.yaml")
                )
        );
    }

}
